package com.sc.nft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.nft.entity.TradingPoolConfig;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

/**
 * @author PC
 * @description 针对表【sc_trading_pool_config(生态池配置)】的数据库操作Mapper
 * @createDate 2024-10-26 13:55:44
 * @Entity com.sc.nft.entity.TradingPoolConfig
 */
public interface TradingPoolConfigMapper extends BaseMapper<TradingPoolConfig> {

    int addStock(@Param("id") Long id, @Param("stock") Integer stock);

    int reduceStock(@Param("id") Long id, @Param("stock") Integer stock);

    int addAmount(@Param("id") Long id, @Param("amount") BigDecimal amount);

    int reduceAmount(@Param("id") Long id, @Param("amount") BigDecimal amount);

    /**
     * 扣资金加库存
     * @param id
     * @param price
     * @param sumCount
     * @return
     */
    int sellInventoryDeduction(@Param("id") Long id, @Param("price") BigDecimal price, @Param("sumCount") Integer sumCount);

    /**
     * 加资金减库存
     * @param id
     * @param price
     * @param sumCount
     * @return
     */
    int buyInventoryDeduction(@Param("id") Long id, @Param("price") BigDecimal price, @Param("sumCount") Integer sumCount);

    /**
     * 减库存
     * @param id
     * @param stock
     * @return
     */
    int subInventory(@Param("id") Long id, @Param("stock") Integer stock);

    void updateDealToday(@Param("id") Long id, @Param("todayHighest") BigDecimal todayHighest, @Param("todayLowest") BigDecimal todayLowest, @Param("toDayVolume") Integer toDayVolume);

    int subAmount(@Param("id") Long id, @Param("destroyAmount") BigDecimal destroyAmount);
}




